package org.longsheng.GroovyLearn.java.aop;

import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class WordStaticProxy implements Word {

    private Word word;

    public void setWord(Word word) {
        this.word = word;
    }

    @Override
    public void addWord(String word) {

        this.word.addWord(word);
    }

    @Override
    public List<String> findKeyword(String content) {
        System.out.println("静态代理哦！");
        before();
        List<String> resultList = this.word.findKeyword(content);
        after(content, resultList);
        return resultList;
    }

    private void before() {
        // TODO
    }

    private void after(String content, List<String> resultList) {
        try {
            log.info("日志：{} - {}", content, resultList);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
